#ifndef __drv_l1_EXT_INT_H__
#define __drv_l1_EXT_INT_H__

#include "driver_l1.h"
#include "drv_l1_sfr.h"

//external interrupt driver
typedef enum
{
	EXTA,
	EXTB,
	EXTC
} EXTAB_ENUM;

typedef enum
{
	FALLING,
	RISING
}EXTABC_EDGE_ENUM;
#define EXTC_INT	0x0100
#define EXTB_INT	0x0080
#define EXTA_INT	0x0040

#define EXTC_POL	0x0020
#define EXTB_POL	0x0010
#define EXTA_POL	0x0008

#define EXTC_IEN	0x0004
#define EXTB_IEN	0x0002
#define EXTA_IEN	0x0001

//key change parameter
#define KEY_CHANGE_PIN0			0x01
#define KEY_CHANGE_PIN1			0x02
#define KEY_CHANGE_PIN2			0x04
#define KEY_CHANGE_PIN3			0x08
#define KEY_CHANGE_PIN4			0x10
#define KEY_CHANGE_PIN5			0x20
#define KEY_CHANGE_PIN6			0x40
#define KEY_CHANGE_PIN7			0x80
#define ALL_KEY_CHANGE_PIN		0xFF
extern void ext_int_init(int enable);
extern void extab_int_clr(INT8U ext_src);
extern void extab_edge_set(INT8U ext_src, INT8U edge_type);
extern void extab_enable_set(INT8U ext_src, BOOLEAN status);
extern void extab_user_isr_set(INT8U ext_src, void (*user_isr) (void));
extern void extab_user_isr_clr(INT8U ext_src);
//key change function
extern void drv_l1_key_change_int_init(void);
extern void drv_l1_key_change_int_enable(INT8U pin_pos,INT8U enable);
extern void drv_l1_key_change_int_pin_pos_set(INT8U pin_pos,INT8U enable);
extern void drv_l1_key_change_set_isr(void (*user_isr)(void));
//extern void drv_l1_key_change_clr_isr(void);

#if defined(ENABLE_WIFI_FUNC) && ENABLE_WIFI_FUNC
#define drv_l1_ext_int_init ext_int_init
#define drv_l1_extabc_edge_set extab_edge_set
#define drv_l1_extabc_user_isr_set extab_user_isr_set
#define drv_l1_extabc_enable_set extab_enable_set
#endif
#endif // __drv_l1_EXT_INT_H__
